package stagefour.service.impl;

import stagefour.dao.ProductDao;
import stagefour.dao.impl.ProductImpl;
import stagefour.model.ProductModel;
import stagefour.model.ResultModel;
import stagefour.service.ProductService;

public class ProductServiceImpl implements ProductService {
    private ProductDao productDao = new ProductImpl();

    @Override
    public ResultModel add(ProductModel productModel) {

        return ResultModel.getResult(productDao.add(productModel));
    }

    @Override
    public ResultModel enable(ProductModel ProductModel) {
//        ProductDao productDao = new ProductImpl();
//        ResultModel ResultModel = new ResultModel();
//        ResultModel.setCount(productDao.enable(ProductModel));
//        return ResultModel;
        return ResultModel.getResult(productDao.enable(ProductModel));
    }

    @Override
    public ResultModel update(ProductModel ProductModel) {
//        ProductDao productDao = new ProductImpl();
//        ResultModel ResultModel = new ResultModel();
//        ResultModel.setCount(productDao.update(ProductModel));
//        return ResultModel;
        return ResultModel.getResult(productDao.update(ProductModel));
    }

    @Override
    public ResultModel delete(ProductModel ProductModel) {
        return ResultModel.getResult(productDao.delete(ProductModel));
    }

    @Override
    public ResultModel findById(ProductModel ProductModel) {
        return ResultModel.getResult(productDao.findById(ProductModel));
    }

    @Override
    public ResultModel findAll(ProductModel ProductModel) {
        return ResultModel.getResult(productDao.findAll(ProductModel), productDao.count(ProductModel));
    }

    @Override
    public ResultModel count(ProductModel ProductModel) {
        return ResultModel.getResult(productDao.count(ProductModel));
    }

    
}
